package com.Interceptor;

import com.xzlcPT.bean.XzLogin;
import com.xzlcPT.service.LoginUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;

/**
 * Created by Administrator on 2017/8/29.
 */
public class BackEndInterceptor extends HandlerInterceptorAdapter {

    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        System.out.println("emp-----"+request.getRequestURI());
        XzLogin loginOnline = (XzLogin) request.getSession().getAttribute("adminLogin");
        if(loginOnline==null){
                response.sendRedirect(request.getServletContext().getContextPath()+"/view/backEnd3/login_back.html");
                return false;
        }else{
                return true;
        }
    }
}
